package com.annotation.condition;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Set;

//自定义返回逻辑需要导入的组件
public class MyImportSelector implements ImportSelector {


    /**
     * @param importingClassMetadata 当前标注在@Import注解的所有注解信息
     * @return 返回值就是要导入的组件的全类名
     */
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {

        Set<String> annotationTypes = importingClassMetadata.getAnnotationTypes();
        return new String[]{"com.annotation.bean.yellow", "com.annotation.bean.Blue"};
    }


}
